class Dog{
//    成员变量
    public String name;
    public  int age;
    public String color;

    public void wag(){
        System.out.println(name+"摇尾巴！");
    }
    public void bark(){
        System.out.println(name+"汪汪汪");
    }
    public void show(){
        System.out.println("姓名: "+ name+" 年龄: "+ age+" 颜色: "+ color);
    }
}
public class Test2 {
//    类的实例化《new关键字》  new什么是在堆上开辟空间
    public static void main(String[] args) {
        Dog dog = new Dog();
        /*System.out.println(dog.name);  //没有赋值就是默认值
        System.out.println(dog.age);   //引用数据类型 null
        System.out.println(dog.color);//基本数据类型 0，boolean ->false*/
//赋值
        dog.name = "初一";
        dog.age = 10;
        dog.color = "黑灰";

        dog.wag();
        dog.bark();
        dog.show();
//        类可以实例化多个对象
        System.out.println("===================");
        Dog dog1 = new Dog();
        dog1.name = "初二";
        dog1.age = 20;
        dog1.color = "白灰";

        dog1.wag();
        dog1.bark();
        dog1.show();
    }
}
